
#ifndef __KHAN_CLI_VTY_OUTPUT_H__
#define __KHAN_CLI_VTY_OUTPUT_H__

#include "khan.hpp"
#include <boost/circular_buffer.hpp>
#include <stdarg.h>     /* for va_start, va_end */

namespace khan {
namespace cli {

class vty_output
: public boost::enable_shared_from_this<vty_output>,                               
private boost::noncopyable       
{
public:
    explicit vty_output();
    ~vty_output() {};

    int     write(const char c);
    int     write(const std::string& string);
    int     write(const char* data, std::size_t size);
    int     write(const char* fmt, ...);
    int     flush(tcp_socket& socket);
    void    dumpOutputMsg();

private:
    enum { BUFFSIZE=8192 };
    typedef boost::circular_buffer<char>    queue_type;
    typedef queue_type::array_range         array_type;

    void    egress( const boost::system::error_code& e,
            std::size_t bytes_transferred);

    int         _width;
    int         _height;
    queue_type  _queue;
};


} }; /* end namespace */

#endif  /* __KHAN_CLI_VTY_OUTPUT_H__ */
